<template>
  <div class="list-item">
      <div class="item-selector">
        <!-- <check-button :is-checked="itemInfo.checked" @click.native="checkClick"/> -->
        <check-button :is-checked="product.checked" @click.native="checkClick"/>
      </div>
      <div class="item-img">
          <img :src="product.image" alt="商品图片">
      </div>
      <div class="item-info">
          <div class="item-title">{{product.title}}</div>
          <div class="item-desc">{{product.desc}}</div>
          <div class="info-bottom">
              <div class="item-price left">￥{{product.price}}</div>
              <div class="item-count right">x{{product.count}}</div>
          </div>
      </div>
  </div>
</template>

<script>
import CheckButton from '@/components/content/checkButton/CheckButton'
export default {
    components: {
      CheckButton
    },
    props: {
        product: {
            type: Object,
            default(){
                return {}
            }
        }
    },
    methods: {
      checkClick(){
        this.product.checked = !this.product.checked;
      }
    }
}
</script>

<style scoped>
    .list-item {
        width: 100%;
        display: flex;
        padding: 5px;
        font-size: 0;
        flex-direction: row;
        border-bottom: 1px solid #ccc;
    }
    .item-selector{
      width: 20px;
      display: flex;
      justify-content: center;
      align-items: center;
    }
    .item-title,.item-desc {
        width: 100%;
        height: 20px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .item-img {
        padding: 5px;
    }

    .item-img img {
    width: 80px;
    height: 100px;
    display: block;
    border-radius: 5px;
  }

  .item-info {
    font-size: 17px;
    color: #333;
    padding: 5px 10px;
    position: relative;
    overflow: hidden;
  }

  .item-info .item-desc {
    font-size: 14px;
    color: #666;
    margin-top: 15px;
  }

  .info-bottom {
    margin-top: 10px;
    position: absolute;
    bottom: 10px;
    left: 10px;
    right: 10px;
  }

  .info-bottom .item-price {
    color: orangered;
  }
</style>